package com.chis.childcheck;

import com.chis.jm.bean.ChildSynInfoBean;
import com.chis.jm.pojo.Inoculation;
import com.chis.jmdatatimer.comm.JedisConnect;
import com.chis.jmdatatimer.comm.JedisSerializeUtil;
import org.apache.commons.lang.StringUtils;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.ShardedJedis;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

/**
 * 
 * @Description 
 * @Company zwx
 * @author wlj
 * @version 2019年08月03日
 */
public class KafkaUpinfo {
    public static void main(String[] args) {
        ShardedJedis jedis = JedisConnect.getInstance().jedisPool.getResource();


        for(int i = 0 ; i < 6 ; i++){
            String key = "group_UPINFO-TOPIC_UPINFO-"+i;
            jedis.select(0);
            String offset = jedis.get(key);
            if (StringUtils.isNotBlank(offset)) {
                jedis.select(1);
                Set<byte[]> value = jedis.zrangeByScore(key.getBytes(), 0, Double.valueOf(offset));
                for(byte[] serVal : value){
                    try {
                        ChildSynInfoBean childSynInfoBean = (ChildSynInfoBean) JedisSerializeUtil.unserialize(serVal);
                        if(childSynInfoBean.getInocList().size() > 0){
                            Inoculation inoculation = childSynInfoBean.getInocList().get(0);
                            System.out.println(inoculation.getInocChilId());
                        }
//                        ProSyncCitydataImpl proDataChildSyn = (ProSyncCitydataImpl) ChildSpringBeanContext.getInstance().getSpringBean("proDataSynService");
//                        proDataChildSyn.syncCitydata(childSynInfoBean);

                    }catch (Exception e){
                        e.printStackTrace();
                    }
                }
            }
        }




    }

}
